import request from '@/config/axios'

export interface OtherInVO {
  id: number
  docId: number
  docDate: localdate
  code: string
  transactionDate: localdate
  operateUser: number
  operateDept: number
  operateDate: localdate
  approveUser: number
  approveDate: localdate
  businessSumQty: number
  costSumAmt: number
  approveStatus: boolean
  annex: string
  remark: string
}

// 查询通用入库单分页
export const getOtherInPage = async (params) => {
  return await request.get({ url: `/wms/other-in/page`, params })
}

// 查询通用入库单详情
export const getOtherIn = async (id: number) => {
  return await request.get({ url: `/wms/other-in/get?id=` + id })
}

// 新增通用入库单
export const createOtherIn = async (data: OtherInVO) => {
  return await request.post({ url: `/wms/other-in/create`, data })
}

// 修改通用入库单
export const updateOtherIn = async (data: OtherInVO) => {
  return await request.put({ url: `/wms/other-in/update`, data })
}

// 删除通用入库单
export const deleteOtherIn = async (id: number) => {
  return await request.delete({ url: `/wms/other-in/delete?id=` + id })
}

// 审核通用入库单
export const approveOtherIn = async (id: number) => {
  return await request.put({ url: `/wms/other-in/approve?id=` + id })
}

// 撤审通用入库单
export const cancelOtherIn = async (id: number) => {
  return await request.put({ url: `/wms/other-in/cancel?id=` + id })
}

// 导出通用入库单 Excel
export const exportOtherIn = async (params) => {
  return await request.download({ url: `/wms/other-in/export-excel`, params })
}

// ==================== 子表（通用入库单身） ====================

// 获得通用入库单身列表
export const getOtherInDListByHeadId = async (headId) => {
  return await request.get({ url: `/wms/other-in/other-in-d/list-by-head-id?headId=` + headId })
}
